package com.cf.auth.module;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author ChenFeng
 * @date 2021/11/8 2:42 下午
 * @description
 */
@Data
@AllArgsConstructor
public class SwordUserDetails implements UserDetails {
    /**
     * 用户id
     */
    private String userId;
    /**
     * 租户ID
     */
    private String tenantId;
    /**
     * 第三方认证ID
     */
    private String oauthId;
    /**
     * 昵称
     */
    private String name;
    /**
     * 真名
     */
    private String realName;
    /**
     * 账号
     */
    private String account;
    /**
     * 部门id
     */
    private String deptId;
    /**
     * 岗位id
     */
    private String postId;
    /**
     * 角色id
     */
    private String roleId;
    /**
     * 角色名
     */
    private String roleName;
    /**
     * 头像
     */
    private String avatar;

    /**
     * 用户详情
     */
    private Map<String,Object> detail;

    private String username;

    private String password;

    private boolean accountNonExpired;
    private boolean accountNonLocked;
    private boolean credentialsNonExpired;
    private boolean isEnabled;
    private List<SwordGrantedAuthority> authorities;

    public SwordUserDetails(){
        this.accountNonExpired = true;
        this.accountNonLocked = true;
        this.credentialsNonExpired = true;
        this.isEnabled = true;
    }

}
